package com.hammer.m3u8downloader.widget;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;

import com.hammer.m3u8downloader.R;

import java.util.ArrayList;
import java.util.List;

public class MenuDialog extends AlertDialog.Builder {
    private List<String> menus = new ArrayList<>();

    public MenuDialog(Context context) {
        super(context, R.style.MyAlertDialogStyle);
    }

    public MenuDialog setMenuTitle(String title) {
        this.setTitle(title);
        return this;
    }

    public MenuDialog addMenuItem(String menu) {
        this.menus.add(menu);
        return this;
    }

    public MenuDialog addMenuItem(List<String> menus) {
        this.menus.addAll(menus);
        return this;
    }

    public MenuDialog setCallBack(DialogInterface.OnClickListener onClickListener) {
        String[] items = this.menus.toArray(new String[0]);
        this.setItems(items, onClickListener);
        return this;
    }
}
